import Vue from 'vue'
import Router from 'vue-router'
import register from './views/register'
import login from './views/login'
import forget from './views/forget'
import home from './views/Home'
import paid from '@/components/bottom/paid'
import privates from '@/components/bottom/privates'
import invite from '@/components/privates/invite'
import record from '@/components/privates/record'
import reward from '@/components/privates/reward'
import deal from '@/components/privates/deal'
import deals from '@/components/head/deal'
import safe from '@/components/privates/safe'
import language from '@/components/privates/language'
import active from '@/components/bottom/active'
import ecology from '@/components/bottom/ecology'
import charge from '@/components/head/recharge'
import assets from '@/components/head/assets'
import cash from '@/components/head/cash'
import trade from '@/components/ecology/trade'
import node from '@/components/ecology/node'
import nodeloan from '@/components/node/nodes'
import shop from '@/components/shop/goods'
import welfare from '@/components/welfare/welfare'
import coin from '@/components/coin/coin'
import news from '@/components/bottom/news'
const originalPush = Router.prototype.push
// Router.prototype.push = function push(location) {
//     return originalPush.call(this, location).catch(err => err)
// }
Vue.use(Router)

export default new Router({
    routes: [
        {
            path: '/',
            component: home
        },
        {
            path:'/register',
            component:register
        },
        {
            path:'/login',
            component:login
        },
        {
            path:'/forget',
            component:forget
        },
        {
            path:'/home',
            component:home,
            children:[
                {
                    path:'',
                    component:paid
                },
                {
                    path:'news',
                    component:news,
                },
                {
                    path:'paid',
                    component:paid,
                    children:[
                        {
                            path:'charge',
                            component:charge
                        },
                        {
                            path:'assets',
                            component:assets
                        },
                        {
                            path:'cash',
                            name:'cash',
                            component:cash
                        },
                        {
                            path:'deals',
                            component:deals
                        }
                    ]
                },
                {
                    path:'privates',
                    component:privates,
                    children:[
                        {
                            path:'invite',
                            component:invite
                        },
                        {
                            path:'record',
                            component:record
                        },
                        {
                            path:'reward',
                            component:reward
                        },
                        {
                            path:'deal',
                            component:deal
                        },
                        {
                            path:'safe',
                            name:'safe',
                            component:safe
                        },
                        {
                            path:'language',
                            component:language
                        }
                    ]
                },
                {
                    path:'active',
                    component:active
                },
                {
                    path:'ecology',
                    component:ecology,
                    children:[
                        {
                            path:'trade',
                            component:trade
                        },
                        {
                            path:'node',
                            component:node
                        },
                        {
                            path:'shop',
                            component:shop
                        },
                        {
                            path:'welfare',
                            component:welfare
                        },
                        {
                            path:'coin',
                            component:coin
                        },
                        {
                            path:'nodeloan',
                            component:nodeloan
                        }
                    ]
                }
            ]
        }
    ]
})
